#include <semaphore.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
  sem_t *sem;
  if (argc < 2 || strcmp(argv[1], "--help") == 0 )
    printf("usage: %s sem-name\n",argv[0]);
  sem = sem_open(argv[1],0);
  if (sem == SEM_FAILED)
    printf("Failed to open semaphore %s\n",argv[1]);
  if (sem_post(sem) == -1)
    printf("Failed to post semaphore %s\n",argv[1]);
  else
    printf("%ld sem_post() succeeded\n", (long)getpid());
  return 0;
}
